package com.itheima;

import java.util.Comparator;
import java.util.TreeSet;

public class Demo8 {
    public static void main(String[] args) {
        String s = "90 -7 0 18 2 0 2 2 45 4";
        String[] arr = s.split(" ");
        TreeSet<Integer> set = new TreeSet<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                int i = o2.compareTo(o1);
                if (i == 0) {
                    return 1;
                } else {
                    return i;
                }
                // return num == 0 ? 1 : num;
            }
        });

        for (int i = 0; i < arr.length; i++) {
            set.add(Integer.valueOf(arr[i]));
        }

        for (Integer integer : set) {
            System.out.println(integer);

        }
    }
}
